﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ page import="com.burry.util.MapList" %>
<%@ page import="com.burry.services.CatalogService" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Bary</title>
<link rel="stylesheet" type="text/css" id="css" href="Resource/css/main.css">
<link rel="stylesheet" type="text/css" href="Resource/yui/build/fonts/fonts-min.css" />
<link rel="stylesheet" type="text/css" href="Resource/yui/build/datatable/assets/skins/sam/datatable.css" />
<script type="text/javascript" src="Resource/yui/build/yahoo-dom-event/yahoo-dom-event.js"></script>
<script type="text/javascript" src="Resource/yui/build/connection/connection-min.js"></script>
<script type="text/javascript" src="Resource/yui/build/json/json-min.js"></script>
<script type="text/javascript" src="Resource/yui/build/paginator/paginator.js"></script>
<script type="text/javascript" src="Resource/yui/build/element/element-min.js"></script>
<script type="text/javascript" src="Resource/yui/build/datasource/datasource-min.js"></script>
<script type="text/javascript" src="Resource/yui/build/datatable/datatable-min.js"></script>
<script type="text/javascript" src="Resource/yui/build/utilities/utilities.js"></script>

<!--end custom header content for this example-->
<link rel="stylesheet" type="text/css" id="css" href="Resource/css/main.css">


<script type="text/javascript" src="../resource/js/global.js"></script>


<%
	CatalogService cs = new CatalogService();
	String treeStr = cs.getTreeStr2(CatalogService.allFaCataInfo);
%>

<body id="yahoo-com" class=" yui-skin-sam">
	<div id="framed">
  	<h2>分类折扣</h2>
  </div>
  
  <div>
		<div>请选择商品</div>
<div id="demo">
    <div id="paging"></div>
    <div id="dt"></div>
    
</div>

<form action="saveCataModel.do" id="goodForm">
	<input type="hidden"  name="beginDate" value="<%=request.getParameter("beginDate")%>"/>
	<input type="hidden"  name="endDate" value="<%=request.getParameter("endDate")%>"/>
	<input type="hidden"  name="modelType" value="<%=request.getParameter("modelType")%>"/>
	<input type="hidden"  name="disType" value="<%=request.getParameter("disType")%>"/>
	<input type="hidden"  name="disValue" value="<%=request.getParameter("disValue")%>"/>
	<input type="hidden"  name="plusValue" value="<%=request.getParameter("plusValue")%>"/>
	
	<input type="hidden" id="catalog" name="catalog" value="<%=request.getParameter("catalog")%>" />
	<input type="hidden" name="catalogNum" value="<%=request.getParameter("catalogNum")%>" />
	
	<input type="hidden" name="goodId" id="goodId"/>
</form>	
		
		<div>
			
<script type="text/javascript">
var myDataTable = null;
YAHOO.util.Event.onDOMReady(function () {
    	
    	  var DataSource = YAHOO.util.DataSource,
        DataTable  = YAHOO.widget.DataTable,
        Paginator  = YAHOO.widget.Paginator;
        

       

        var myDataSource = new DataSource("listGoodInit.do?");
        myDataSource.responseType = DataSource.TYPE_JSON;
        myDataSource.responseSchema = {
        		resultsList :"returnObj",  
            fields: ["good_id","good_name","good_feature","good_intro","good_size","like_id","fix_id","current_price","ori_price","cata_id"],
            metaFields: {totalRecords: "totalRecords" }     
        };

		    var buildQueryString = function (state,dt) {
		        return "startIndex=" + state.pagination.recordOffset +
		               "&results=" + state.pagination.rowsPerPage;
		    };
		
		    var myPaginator = new Paginator({
		        containers         : ['paging'],
		        pageLinks          : 5,
		        rowsPerPage        : 15,
		        rowsPerPageOptions : [15,30,60],
		        template           : "<strong>{CurrentPageReport}</strong> {PreviousPageLink} {PageLinks} {NextPageLink} {RowsPerPageDropdown}",
		        firstPageLinkLabel:"首页",
            lastPageLinkLabel:"末页",
            nextPageLinkLabel:"下一页",
            previousPageLinkLabel:"上一页"

		    });
		
		    var myTableConfig = {
		        initialRequest         : 'startIndex=0&results=25',
		        generateRequest        : buildQueryString,
		        paginationEventHandler : DataTable.handleDataSourcePagination,
		        paginator              : myPaginator
		    };
		    
		    var myColumnDefs = [
            {key:"id",label:"选择商品",formatter:"checkbox"},
            {key:"good_id",label:"商品编号"},
            {key:"good_name",label:"商品名称"},
            {key:"good_feature",label:"商品特性"},
            {key:"good_intro",label:"商品简介"},
            {key:"good_size",label:"商品尺码表"},
            {key:"fix_id",label:"搭配商品"},
            {key:"like_id",label:"可能喜欢商品"},
            {key:"current_price",label:"现价"},
            {key:"ori_price",label:"原价"},
            {key:"cata_id",label:"商品分类"}
        ];

        myDataTable = new DataTable("dt", myColumnDefs, myDataSource, myTableConfig);
				myDataTable.subscribe("rowMouseoverEvent", myDataTable.onEventHighlightRow);   
	      myDataTable.subscribe("rowMouseoutEvent", myDataTable.onEventUnhighlightRow);   
	      myDataTable.subscribe("rowClickEvent", myDataTable.onEventSelectRow);   
        
        myDataTable.subscribe("checkboxClickEvent", function(oArgs){
            var elCheckbox = oArgs.target;
            var oRecord = this.getRecord(elCheckbox);
            var goodId = (oRecord.getData("good_id"));
            $j('goodId').value = $j('goodId').value + "," + goodId;
            //oRecord.setData("check",elCheckbox.checked);
        });

       
});	
</script>	
		</div>
		
<div>录入的数量：</div>
<div id="numResult"></div>
		
		<div><input type="button" value="上一步" onclick="preStep()" /> &nbsp;<input type="button" value="保存" onclick="nextStep()" /></div>
		
		
		<script language="javascript">
			function nextStep(){
				//location = "addModel_good.jsp";
				//alert($j('goodId').value);
				$j('goodForm').submit();
			}	
			
			function preStep(){
				history.go(-1);
			}
		</script>
  </div>
</body>
</html>